#include<iostream>
using namespace std;
long long n,L,R;
long long ans=-0xffffff;
int main()
{
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin>>n>>L>>R;
	for(int k=L;k<=R;k++)
	{
		long long flag=k;
		while(flag>=0)
		{
			if(flag-n<0) break;
			else flag-=n;
		}
		ans=max(ans,flag);
	}
	cout<<ans;
	fclose(stdin);
	fclose(stdout);
}
